home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / demos / OpenGL / backtrace / README < prev    next >
Text File  |  1996-11-11  |  7KB  |  124 lines

  1.  
  2.  
  3.  
  4.                                Backtrace Demo
  5.  
  6. Backtrace is an OpenGL demo meant to simulate caustics like those produced by
  7. reverse ray tracing. The demo draws three spotlights whose light is refracted
  8. through a sphere.
  9.  
  10. backtrace.tar.Z is a compressed tar file containing the backtrace source code.
  11.  
  12. To select a light, click on it with the mouse. The lights are specified in
  13. spherical coordinates. Dragging with the left mouse button changes theta (the
  14. angle around the z axis). Dragging toward or away from the center of the window
  15. using the middle mouse button changes the radius, or the distance of the light
  16. from the sphere. Dragging with the right mouse button changes phi, or the
  17. inclination of the light. Note that chaging theta is very quick while chaning r
  18. or phi is slow -- this is because the shadows and caustics do not need to be
  19. recomputed if only theta changes.
  20.  
  21. The pulldown menus may be used to change various parameters. The "Material"
  22. menu may be used to change the index of refraction of the sphere. The "Draw"
  23. menu turns the drawing of various portions of the scene on and off. The
  24. "Subdivision" menu changes the tessellation of the square, shadows, caustics
  25. and sphere. Use the "Lights" menu to turn lights on and off. Under the "Motion"
  26. menu, the "Quick Motion" option halts recomputation of shadows until after the
  27. mouse button is released. The "Rotate Automatically" button sets the lights
  28. rotating independently about the z axis for a non-interactive demo.
  29.  
  30. The elements of the scene are drawn in a variety of ways. The floor is drawn as
  31. a triangular mesh illuminated by three spotlights. Next the shadows are drawn
  32. without enabling the zbuffer. They are drawn by setting the color mask to
  33. correspond to the color of the light which is casting the shadow so that they
  34. will not interfere with the components of the color created by the other light
  35. sources. The shadow is drawn in the scene's ambient color. Shadows are
  36. precomputed as disks projected from the location of the sphere through the
  37. light's location into the xy plane. The refractions are projected in the same
  38. way, except the direction of the projection is modified to take into account
  39. the index of refraction of the material. The intensity of the light in the
  40. refraction is computed using the difference in the area of a section between
  41. the shadow and the refraction. For example, if a given section has an area of 1
  42. in the shadow and an area of 1.3 in the refraction, the intensity of the light
  43. used when drawwing the refraction is 1.3 times the intensity used when drawing
  44. that section of the shadow. In other words, a given quantity of light appears
  45. brighter if it is spread over a smaller area. The caustics are drawn using
  46. blending functions.
  47.  
  48. The three-dimensional objects used to draw the light sources are drawn next
  49. using two-sided lighting so that the inside and the outside appear to be lit
  50. differently. Next the image of the scene as viewed through the sphere is drawn.
  51. An image of the sphere is drawn into the stencil plane. Stenciling is enabled
  52. and the scene is re-rendered using a larger field of view, which makes objects
  53. appearing through the sphere look smaller. The sphere itself is drawn as a
  54. rather hacked lit disk which is more transparent in the center than around the
  55. edges. This allows the sphere to look as though it has some substance.
  56.  
  57.  
  58.  
  59.              old backtrace README stuff
  60.  
  61.  
  62.        
  63. ABOUT THIS PROGRAM:
  64.     Backtrace is an OpenGL program meant to simulate ray tracing.
  65. It displays a refractive sphere above a plane.  The sphere is lit by
  66. red, green, and blue spotlights which may be manually moved.  The
  67. shadow of the sphere and the light which is refracted through the
  68. sphere are projected onto the plane.
  69.     The "Material" menu controls the refractiveness of the sphere.
  70.     The "Draw" menu controls which subparts of the scene are
  71. drawn.  By default, the "Draw Texture" option is off.  Texture mapping
  72. is slow on many systems and the texture map is completely gratuitous.
  73. However, you may want to turn texture mapping on once to see if the
  74. performance is acceptable on your system.
  75.     The "Subdivision" menu controls the number of subdivisions
  76. used to draw the plane, the sphere, the lights, the shadows, and the
  77. refractions.  More subdivisions will look better, but will be slower.
  78.     The "Lights" menu can be used to turn the lights on and off on
  79. an individual basis.  The "Reset Lights" button moves all the lights
  80. back to their original positions.
  81.     The "Quick Motion" option under the option menu makes motions
  82. in r and phi (controlled by the middle and right mouse buttons,
  83. respectively) happen much more quickly by delaying recompuation of the
  84. shadows and refraction until the mouse button is released.  The
  85. "Rotate Automatically" toggle causes the lights to rotate about the z
  86. axis at random speeds.
  87.     Moving of the lights is accomplished with the mouse.  The
  88. author wishes to apologize for the horribly awkward interface.  To
  89. move a light, move the pointer over it and press one of the mouse
  90. buttons down.  Draw the mouse to move the light.  It is easiest to
  91. imagine the lights in spherical coordinates.  The left mouse button
  92. controls rotation in theta (about the z axis).  Moving the mouse
  93. horizontally while holding down the left mouse button will increase or
  94. decrease theta.  
  95.     The middle mouse button controls the radius, or the distance
  96. of the light from the sphere.  Dragging the mouse toward the center of
  97. the screen decreases the distance of the light from the sphere, while
  98. moving away from the center of the screen increases the distance.
  99.     The right mouse button controls rotation in phi, which can be
  100. thought of as the elevation of the light.  Moving the mouse
  101. horizontally will change the elevation.
  102.  
  103. TO COMPILE:
  104.         If you have not already done so, copy all files from the CDROM
  105. to a directory on your computer.
  106.         First, run the shell script UNCAP to get everything back from
  107. upper case letters.
  108.         Type "make."  Note that you must have a C++ compiler
  109. installed.  There may be a warning or two, but these should not cause
  110. problems.  You must first have compiled libGLw.a and libtk.a.  You
  111. must also have a development copy of Motif installed.
  112.  
  113. OTHER MAKEFILE TARGETS:
  114.         "make clean" removes objects, ~ files, and core files.
  115.         "make clobber" also removes the executable.
  116.  
  117. KNOWN BUGS:
  118.     It's possible to change the phi of a light in such a way that
  119. the light gets below the sphere, which leads to unexpected (and
  120. inaccurate) results.
  121.  
  122. AUTHOR:
  123.         Celeste Fowler
  124.